package utils;

/**
 * Library of functions for Date
 * @author chocoseb
 */
public abstract class ChocoDate {

    /**
     *
     * @return Calendar representing the current date
     */
    public static java.util.Calendar now(){
        return java.util.GregorianCalendar.getInstance();
    }

    /**
     * Format a Calendar value to a String of format dd MMMM yyyy HH:mm:ss.
     * @param value The Calendar value
     * @return A formated String.
     */
    public static String formatDateTime(java.util.Calendar value){
        java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd MMMM yyyy HH:mm");
        return format.format(value.getTime());
    }

    /**
     * Format a Calendar value to a String of format dd MMMM yyyy.
     * @param value The Calendar value
     * @return A formated String.
     */
    public static String formatDateOfMonth(java.util.Calendar value){
        java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("dd MMMM yyyy");
        return format.format(value.getTime());
    }
}
